home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-21 | 2.6 KB | 87 lines | [TEXT/MPS ] |
- C FaceWare 2.2 Initialization & Dispatching Procedures
- C ©FaceWare 1989-93. All Rights Reserved.
-
- SUBROUTINE FaceIt(xPtr,m1,m2,m3,m4,m5)
- implicit none
- integer*4 JumpIt
- inline (JumpIt = /z'2257',z'2051',z'4e90'/)
- integer*4 xPtr,m1,m2,m3,m4,m5,i,restype,thePtr,fPtr
- record /FaceRec/ fRec
- common/FaceStuff/fRec
- thePtr = xPtr
- fPtr = %loc(fRec)
- if (m1 == -61) then
- if ((m4 > -1).and.((m4.and.1) == 0)) then
- call FlushEvents(%val2(62),%val2(0)) !ignore spurious mouse & key events
- end if
- fRec.uName = char(len(trim(fRec.uName)))//fRec.uName
- restype = z'46434D44' != "FCMD", find LoadIt or quit to Finder
- if (GetResource(%val4(restype),%val2(1000)) == 0) then
- if (OpenResFile(fRec.uName) < 0) stop
- end if
- fRec.fFlags = m2 !store FaceIt bit flags
- fRec.xEntries = m5 !store # of table entries
- thePtr = fPtr
- if (m3 > -1) then !call LoadIt to expand heap?
- call PrepIt(thePtr,m3,0,0,thePtr)
- call JumpIt(%val4(thePtr))
- end if
- call PrepIt(thePtr,1100,22,0,thePtr) !setup fRec header
- call PrepIt(thePtr+1002,1210,22,0,thePtr) !setup uRec header
- call PrepIt(thePtr+1634,1200,22,0,thePtr) !setup vRec header
- fRec.fHead(6) = m4 !store environment type
- fRec.uHead(6) = 2 !establish string type
- thePtr = 0
- if (m4 < -3) return
- end if
- if (m1 == -62) then
- call PrepIt(m2,m3,m4,m5,fPtr)
- else if ((m1 < 0).and.(m1 > -11)) then
- i = (4 * (-1 - m1))
- fRec.xTable(1+i) = m2
- fRec.xTable(2+i) = m3
- fRec.xTable(3+i) = m4
- fRec.xTable(4+i) = m5
- else
- if (thePtr == 0) then !call to default module?
- thePtr = fPtr + 1002
- else if (long(thePtr + 12) <> fPtr) then
- fRec.cControl = thePtr !call to control driver?
- thePtr = fPtr + 1634
- end if
- word(thePtr + 8) = 0
- fRec.uCommand = m1 !pass Command & Params
- fRec.uParam(1) = m2
- fRec.uParam(2) = m3
- fRec.uParam(3) = m4
- fRec.uParam(4) = m5
- call JumpIt(%val4(thePtr)) !jump to FCMD module
- end if
- end
-
- SUBROUTINE PrepIt(x,b,v,r,f)
- implicit none
- integer*4 x,b,v,r,f,i,restype,resptr
- record /FaceRec/ fRec
- common/FaceStuff/fRec
- restype = z'46434D44' != "FCMD"
- resptr = long(GetResource(%val4(restype),%val2(1000)))
- long(x) = resptr
- word(x+4) = b !baseID
- word(x+6) = v !versID
- word(x+8) = 0 !message
- word(x+10) = r !resID
- long(x+12) = f !fPtr
- if (fRec.xEntries > 0) then
- do (i = 0, fRec.xEntries-1)
- if (b == fRec.xTable(1 + 4*i)) then
- if (v == fRec.xTable(2 + 4*i)) then
- if (0 <> fRec.xTable(4 + 4*i)) then
- long(x) = fRec.xTable(4 + 4*i)
- end if
- end if
- end if
- end do
- end if
- end
-